
{block name="css"}

{CSS href="__STATIC__/admin/hui/static/h-ui/css/H-ui.min.css" /}
{CSS href="__STATIC__/admin/hui/static/h-ui.admin/css/H-ui.admin.css" /}
{CSS href="__STATIC__/admin/hui/lib/Hui-iconfont/1.0.8/iconfont.css" /}

{CSS href="__STATIC__/w/layui.css" /}
{CSS href="__STATIC__/w/divtable.css" /}
{CSS href="__STATIC__/admin/uploadify/uploadify.css" /}
{/block}

{block name="js"}
{js href='__STATIC__/w/jquery1110min.js' /}
{js href='__STATIC__/w/layui.js' /}
{load href="__STATIC__/admin/hui/lib/My97DatePicker/4.8/WdatePicker.js" /}
<!--上传配置 -->
{js href='__STATIC__/admin/uploadify/jquery.uploadify.min.js' /}
{js href='__STATIC__/admin/js/upfile.js' /}
<script type="text/javascript">
    upload_image('png');
    upload_image('bg');
    var URL = {
        uploader: '{:url('Upload/image')}',
        swf:'__STATIC__/admin/uploadify/uploadify.swf',
        ROOT:'__PUBLIC__/uploads/image',
    }
</script>
{/block}

{block name="main"}

<nav class="breadcrumb">
    <i class="Hui-iconfont">&#xe67f;</i> 首页
    <span class="c-gray en">&gt;</span> 幸运水果
    <span class="c-gray en">&gt;</span> 添加活动
    <a class="btn radius btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新">
        <i class="Hui-iconfont">&#xe68f;</i>
    </a>
</nav>

<form class="layui-form layui-form-cont" action="">
    <div class="content">

<div class="cLineB">
    <h4>编辑幸运水果活动开始内容</h4><a href="javascript:history.go(-1);"  class="right btnGrayS vm" style="margin-top:-27px" >返回</a>
</div>
<div class="msgWrap bgfc">
    <table class="layui-table"><TBODY>
    <TR>
        <th valign="top"><span class="red">*</span>关键词：</th>
        <TD>
            <input type="input" class="px" id="keyword" value="{$vo['keyword']??'幸运水果'}" name="keyword" style="width:400px" ><br />
            <span class="red">只能写一个关键词</span>，用户输入此关键词将会触发此活动。
        </TD>
        <TD rowspan="7" valign="top">
            <div style="margin-left:20px">
                    <div id="bg_s"><img src="__PUBLIC__/uploads/{$vo.starpicurl ?'image/'.$vo.starpicurl: 'sm_300.jpg'}" width="200px" height="200px"/></div>
                    <input id="bg_post" name="starpicurl" type="hidden" value="{$vo.starpicurl ??''}"/>
                    <input id="bg" name="bg_upload" type="file" multiple="true">
                    <p class="tip_for_p">提示：活动开始图片</p>

            </div>
        </TD>
    </TR>
    <TR>
        <th valign="top"><span class="red">*</span>活动名称：</th>
        <TD>
            <input type="input" class="px" id="title" value="{$vo['title'] ??'幸运水果活动开始了'}" name="title" style="width:400px" />
            <br />
            请不要多于50字!
        </TD>
    <TR>
        <th valign="top"><span class="red">*</span>兑奖信息：</th>
        <td>
            <input type="input" class="px" id="txt" value="{$vo['txt']??'兑奖请联系我们，电话138********'}" name="txt" style="width:400px" />
            <br />请不要多于100字! 这个设定但用户输入兑奖时候的显示信息!
        </td>
    </TR>
    <TR>
        <th valign="top"><span class="red">*</span>中奖提示：</th>
        <td><textarea class="px"   name="sttxt" style="width:400px"  >{$vo.sttxt ??''}</textarea>
        </td>
    </TR>
    <TR>
        <th><span class="red">*</span>活动时间：</th>
        <td><input type="input" class="px" id="statdate" value="{$vo.statdate|date="Y-m-d",###}" onClick="WdatePicker()" name="statdate" />
            到
            <input type="input" class="px" id="enddate" value="{$vo.enddate|date="Y-m-d",###}" onClick="WdatePicker()"  name="enddate"  />
        </td>
    </TR>
    <TR>
        <th valign="top">活动说明：</th>
        <td><textarea  class="px" id="info" name="info"  style="width:400px; height:125px" >{$vo['info']??'亲，请点击进入幸运水果抽奖活动页面，祝您好运哦'}</textarea><br />换行请输入
            &lt;br&gt;
        </td>
    </TR>
    <TR>
        <th><span class="red">*</span>重复抽奖回复：</th>
        <td><input type="input" class="px" id="aginfo" value="{$vo['aginfo']??'亲，继续努力哦！'}" name="aginfo" style="width:400px" />备注：
            如果设置只允许抽一次奖的，请写：你已经玩过了，下次再来。

            如果设置可多次抽奖，请写：亲，继续努力哦！</td>
    </TR>
    </TBODY>
    </TABLE>
</div>

<!--活动结束-->
<div class="cLineB">
    <h4>活动结束内容</h4></div>
<div class="msgWrap bgfc">

    <table class="layui-table">
        <tbody>
        <tr>
            <th valign="top"><span class="red">*</span>活动结束公告主题：</th>
            <td><input type="input" class="px" id="endtite" value="{$vo['endtite'] ??'幸运水果活动已经结束了'}" name="endtite" style="width:400px" />
                <br />
                请不要多于50字! </td>
            <td rowspan="4" valign="top"><div style="margin-left:20px">
                <div id="png_s"><img src="__PUBLIC__/uploads/{$vo.endpicurl ?'image/'.$vo.endpicurl: 'sm_300.jpg'}" width="200px" height="200px"/></div>
                <input id="png_post" name="endpicurl" type="hidden" value="{$vo.endpicurl ??''}"/>
                <input id="png" name="png_upload" type="file" multiple="true">
                <p class="tip_for_p">提示：活动结束图片</p>
            </td>
        </tr>
        <tr>
            <th valign="top">活动结束说明：</th>
            <td valign="top"><textarea  class="px" id="endinfo" name="endinfo"  style="width:400px; height:125px" >{$vo['endinfo']??'亲，活动已经结束，请继续关注我们的后续活动哦。'}</textarea><br />换行请输入
                &lt;br&gt;
            </td>
        </tr>
        </tbody>
    </table>
</div>


<!--奖项设置-->
<div class="cLineB">
    <h4>奖项设置</h4>
</div>
<div class="msgWrap bgfc">

    <table class="layui-table">
        <TBODY>
        <TR>
            <th valign="top"><span class="red">*</span>一等奖奖品设置：</th>
            <td><input type="input" class="px" id="fist"   name="fist" value="{$vo.fist ?? '' }" style="width:250px"/>
                请不要多于50字! </td>
            
        </TR>
        <TR>
            <th valign="top"><span class="red">*</span>一等奖奖品数量：</th>
            <td><input type="input" class="px" id="fistnums" name="fistnums"      value="{$vo.fistnums ?? '' }"style="width:60px" />
                <span class="red">如果是100%中奖,请把一等奖的奖品数量[ 1000就代表前1000人都中奖 ]填写多点</span></td>
        </TR>
        <TR>
            <th valign="top">二等奖奖品设置：</th>
            <td><input type="input" class="px" id="second" name="second"     value="{$vo.second ?? '' }" style="width:250px"/>
                请不要多于50字! </td>
        </TR>
        <TR>
            <th valign="top">二等奖奖品数量：</th>
            <td><input type="input" class="px" id="secondnums" name="secondnums"   value="{$vo.secondnums ?? '' }"style="width:60px" />
            </td>
        </TR>
        <TR>
            <th valign="top">三等奖奖品设置：</th>
            <td><input type="input" class="px" id="third" name="third"   value="{$vo.third ?? '' }"style="width:250px" />
                请不要多于50字! </td>

        </TR>
        <TR>
            <th valign="top">三等奖奖品数量：</th>
            <td><input type="input" class="px" id="thirdnums" name="thirdnums"     value="{$vo.thirdnums ?? '' }"style="width:60px" />
            </td>

        </TR>
        <TR>
            <th valign="top">四等奖奖品设置：</th>
            <td><input type="input" class="px" id="four"  name="four" value="{$vo.four ?? ''}"  style="width:250px"/>
                请不要多于50字! </td>
            
        </TR>
        <TR>
            <th valign="top">四等奖奖品数量：</th>
            <td><input type="input" class="px" id="fournums" name="fournums"      value="{$vo.fournums?? ''}" style="width:60px" />
            </td>
        </TR>
        <TR>
            <th valign="top">五等奖奖品设置：</th>
            <td><input type="input" class="px" id="five"  name="five" value="{$vo.five ?? ''}"  style="width:250px"/>
                请不要多于50字! </td>
            
        </TR>
        <TR>
            <th valign="top">五等奖奖品数量：</th>
            <td><input type="input" class="px" id="fivenums" name="fivenums"      value="{$vo.fivenums?? ''}" style="width:60px" />
            </td>
        </TR>
        <TR>
            <th valign="top">六等奖奖品设置：</th>
            <td><input type="input" class="px" id="six"  name="six" value="{$vo.six ?? ''}"  style="width:250px"/>
                请不要多于50字! </td>
            
        </TR>
        <TR>
            <th valign="top">六等奖奖品数量：</th>
            <td><input type="input" class="px" id="sixnums" name="sixnums"      value="{$vo.sixnums?? ''}" style="width:60px" />
            </td>
        </TR>

        </tbody>
        <tbody>
        <TR>
            <th valign="top"><span class="red">*</span>预计活动的人数：</th>
            <td><input type="input" class="px" id="allpeople" name="allpeople"   value="{$vo.allpeople ?? '' }"style="width:150px"/>  预估活动人数直接影响抽奖概率：中奖概率 = 奖品总数/(预估活动人数*每人抽奖次数) 如果要确保任何时候都100%中奖建议设置为1人参加!<span class='red'>如果要确保任何时候都100%中奖建议设置为1人参加!并且奖项只设置一等奖.</span></td>
        </TR>
        <TR>
            <th valign="top"><span class="red">*</span>每人最多允许抽奖次数：</th>
            <td><input type="input" class="px" id="canrqnums" name="canrqnums"   value="{$vo.canrqnums ?? '' }"style="width:150px"/>
                必须1-5之间的数字</td>
        </TR>
        <tr>
            <th valign="top"><span class="red"></span>每天最多抽奖次数：</th>
            <td><input class="px" id="daynums" name="daynums" style="width:150px" value="{$vo.daynums ?? '' }"type="input">
                必须小于总抽奖次数！ 0 为不限制 抽完总数就不能抽了! 可以抽奖天数 = 总数/每天抽奖次数!</td>
        </tr>
        <tr>
            <th valign="top"><span class="red">*</span>兑奖密码：</th>
            <td><input class="px" id="parssword" name="parssword" value="{$vo.parssword ?? '' }"style="width:150px" type="input">
                消费确认密码长度小于15位</td>
        </tr>
        <tr>
            <th valign="top">SN码重命名为：</th>
            <td><input class="px" id="renamesn" name="renamesn" value="{$vo.renamesn??'SN码'}" style="width:150px" type="input"> 例如：CND码,充值密码,SN码 这个主意用于修改SN码的名称，不懂请别修改</td>
        </tr>
        <tr>
            <th valign="top">手机号重命名：</th>
            <td><input class="px" id="renametel" name="renametel" value="{$vo.renametel??'手机号'}" style="width:150px" type="input"> 例如：QQ号,微信号,手机号等其他联系方式，不懂请别修改</td>
        </tr>
        <TR>
            <th valign="top">抽奖页面是否显示奖品数量：</th>
            <td><input class="radio" type="radio" name="displayjpnums" value="1"  {$vo['displayjpnums'] ??'checked'} >显示  <input class="radio" type="radio" name="displayjpnums" value="0"  {$vo['displayjpnums'] ??'checked'}>不显</td>
        </TR>
        <TR>
            <th valign="top">注册后才能参与：</th>
            <td><input class="radio" type="radio" name="needreg" value="1"  {$vo['needreg']??'checked'} > 需要先注册  <input class="radio" type="radio" name="needreg" value="0"  {$vo['needreg'] ??'checked'}> 不需要先注册</td>
        </TR>
        <TR>
            <th>&nbsp;</th>
            <td>
                <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                <button type="submit" class="btnGreen" >保存</button>　<a href=""  class="btnGray vm">取消</a>　
                <button type="reset" class="layui-btn radius layui-btn-warm">重置</button>
                <button type="button" class="layui-btn radius layui-btn-primary" onClick="window.history.back();">返回上一页</button>
                <span class="red">请确认功能管理已开启幸运水果功能</span></td>
        </TBODY>
    </TABLE>
</div>
</div>
</form>
<script>
    layui.use('form', function () {
        var form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function (data) {
            layer.load(1);

            // layer.msg(JSON.stringify(data.field));
            $.post('',data.field,function (res) {
                if(res.status=='0'){
                    layer.closeAll('loading');
                    layer.msg(res.msg);
                }
                if(res.status=='1'){
                    layer.closeAll('loading');
                    layer.msg(res.msg);
                    window.location.href=res.url;
                }
            });
            return false;
        });
    });
</script>
{/block}
